import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Index',
      component: () => import('@/views/Index'),
    },{
      path: '/news',
      name: 'News',
      component: () => import('@/views/News'),
    },
    {
      path: '/inter',
      name: 'Inter',
      component: () => import('@/views/Inter'),
    },{
      path: '/exter',
      name: 'Exter',
      component: () => import('@/views/Exter'),
    },{
      path: '/shudu',
      name: 'Shudu',
      component: () => import('@/views/Shudu'),
    },{
      path: '/nav',
      name: 'Nav',
      component: () => import('@/components/Nav'),
    },{
      path: '/login',
      name: 'Login',
      component: () => import('@/views/admin/Login'),
    },{
      path: '/admin',
      name: 'Admin',
      component: () => import('@/views/admin/Admin'),
      children :[
        {
          path : '/user',
          name : 'User',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component : ()=> import('@/views/admin/User')
        },{
          path : '/role',
          name : 'Role',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component : ()=> import('@/views/admin/Role')
        },{
          path : '/ainter',
          name : 'Inter',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component : ()=> import('@/views/admin/Inter')
        },{
          path : '/aexter',
          name : 'Exter',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component : ()=> import('@/views/admin/Exter')
        },{
          path : '/ashudu',
          name : 'Shudu',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component : ()=> import('@/views/admin/Shudu')
        }
      ]
    }
  ]
})
